package tx.os3.clientserver.client.connection;

import java.io.File;

public interface ProtocolAdapter {

    public static final String COMMAND_INFO = "INFO";
    public static final String COMMAND_DIR = "DIR";
    public static final String COMMAND_PUT = "PUT";
    public static final String COMMAND_DELETE = "DEL";
    public static final String COMMAND_RENAME = "REN";
    public static final String COMMAND_GET = "GET";
    public static final String COMMAND_DISCONNECT = "QUIT";

    /**
     * Requests info from the server.
     */
    public void getServerInfo();

    /**
     * Requests a directory listing of the given directory.
     * 
     * @param directory
     *            The full path to the directory to be listed.
     */
    public void listDir(String directory);

    /**
     * Puts the given file.
     * 
     * @param file
     *            The file to transfer.
     */
    public void put(File file);

    /**
     * Deletes the file or dir with the given file name.
     * 
     * @param fileName
     *            The file name to delete.
     */
    public void delete(String fileName);

    /**
     * Renames the file or dir with the given fileName to the given newFileName.
     * 
     * @param fileName
     *            The current file name.
     * @param newFileName
     *            The new file name.
     */
    public void rename(String fileName, String newFileName);

    /**
     * Gets the file with the given file name from the server.
     * 
     * @param fileName
     *            The full path to get.
     */
    public void get(String fileName);

    /**
     * Syncs the webroot of the server with the webroot of the client.
     */
    public void sync();

    /**
     * Tries to connect to the server.
     * 
     * @return True on success, false otherwise.
     */
    public boolean connect();

    /**
     * Disconnects from the server.
     */
    public void disconnect();

}
